#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string A;
    cin >> A;
    string B;
    cin >> B;
    int max = 0;
    int lena = A.size(), lenb = B.size();
    for (int i = 0;i <= lenb - lena;i++)
    {
        int j = 0, k = i;
        int count = 0;
        while (j < A.size())
        {
            cerr << A[j] << " " << B[k] << endl;
            if (A[j] == B[k]) count++;
            ++j;
            ++k;
        }
        if (count > max) max = count;
        cerr << "------" << endl;
    }
    cout << A.size() - max << endl;
    return 0;
}
